package com.ocm.tourism.core.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ocm.tourism.core.dao.MapInfoDao;
import com.ocm.tourism.core.domain.MapInfo;

@Service
public class MapInfoServiceImpl implements MapInfoService {
    @Autowired
    MapInfoDao mapInfoDao;

    @Transactional
    public void saveMapInfo(MapInfo mapInfo){
        if(mapInfo.getId() == null || mapInfo.getId() == 0)
            mapInfoDao.save(mapInfo);
        else
            mapInfoDao.update(mapInfo);
    }

    @Transactional
    public MapInfo updateMapInfo(MapInfo mapInfo){
        return mapInfoDao.update(mapInfo);
    }

    @Override
    public MapInfo findMapInfo(Long id) {
        return mapInfoDao.find(id);
    }
}